package com.wc.算法提高课.E第五章_数学知识.组合计数.网格;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/7 20:02
 * @description https://www.acwing.com/problem/content/description/1317/
 */
public class Main {
    /**
     * 思路：卡特兰数<p>
     * (n, m) 关于 y = x + 1对称点 (m - 1, n + 1)<p>
     * C(n + m, n) - C(n + m, m - 1)
     *
     * @see com.wc.算法基础课.D第四讲数学知识.求组合数.满足条件的01序列;
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 10010;
    static BigInteger[] fact = new BigInteger[N];
    static int n, m;

    public static void main(String[] args) {
        fact[0] = new BigInteger("1");
        for (int i = 1; i < N; i++) {
            fact[i] = fact[i - 1].multiply(new BigInteger(String.valueOf(i)));
        }
        n = sc.nextInt();
        m = sc.nextInt();
        out.println(C(n + m, n).subtract(C(n + m, n + 1)));
        out.flush();
    }

    static BigInteger C(int n, int m) {
        return fact[n].divide(fact[m].multiply(fact[n - m]));
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
